package com.loveshare.info.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.loveshare.common.util.HttpClientIpUtil;
import com.loveshare.common.util.HttpRequest;
import com.loveshare.log.service.LogService;
import com.loveshare.love.bean.SimpleLoveShow;
import com.loveshare.love.service.LoveShowService;

@Controller
@RequestMapping(value="p")
public class PCInfoController {
	@Autowired
	private LoveShowService loveShowService;
	@Autowired
	private LogService logService;
	
	/**
	 * 表白墙首页
	 * @return
	 */
	@RequestMapping(value="index",method=RequestMethod.GET)
	public String index(ModelMap map,HttpServletRequest request){
		String ip=HttpClientIpUtil.getIP(request);
		//记录访问者信息
		logService.addArticleInfo(ip,HttpRequest.getIpRegion(ip),3);
		List<SimpleLoveShow> loveShows=loveShowService.getLoveShows(1,36);
		map.put("loveShows", loveShows);
		return "pc/loveShow/index";
	}
}
